import React, { useState, useEffect } from 'react'
import { Form, Select } from 'antd'
import moment from 'moment'
const { Option } = Select
const { Item } = Form
function Main () {
  const [years, setYears] = useState<number[]>([])
  useEffect(() => {
    const ys: number[] = []
    const y = moment().year()
    for (let i = y; i >= 2013; i--) {
      ys.push(i)
    }
    setYears(ys)
  }, [])
  return (
    <Item label='年份' name='year'>
      <Select placeholder='请选择' allowClear>
        {
          years.map(li => <Option key={li} value={li}>{li}</Option>)
        }
      </Select>
    </Item>
  )
}

export default Main
